import { getSearchInfo } from '@/api/home.js'
const state = {
  searchList: {}
}
const mutations = {
  SET_SEARCH_LIST (state, payload) {
    state.searchList = payload
  }
}
const actions = {
  async getSerchList ({ commit }, params) {
    const res = await getSearchInfo(params)
    commit('SET_SEARCH_LIST', res.data)
  }
}
const getters = {
  goodsList (state) {
    return state.searchList.goodsList || []
  },
  attrsList (state) {
    return state.searchList.attrsList || []
  },
  trademarkList (state) {
    return state.searchList.trademarkList || []
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
